import request from '@/utils/request'
import { paramNoNull } from '@/utils/ParamFilter'

export function page(data) {
  return request({
    url: '/admin/bee-manage/sys-role/page',
    method: 'get',
    params: paramNoNull(data)
  })
}

export function pageAll(data) {
  return request({
    url: '/admin/bee-manage/sys-role/page',
    method: 'get',
    params: paramNoNull(data)
  })
}

export function deleteById(id) {
  return request({
    url: '/admin/bee-manage/sys-role/' + id,
    method: 'delete'
  })
}

export function deleteByIds(ids) {
  return request({
    url: '/admin/bee-manage/sys-role/batch',
    method: 'post',
    data: ids
  })
}

export function clear() {
  return request({
    url: '/admin/bee-manage/sys-role/clear',
    method: 'delete'
  })
}

export function recover(ids) {
  return request({
    url: '/admin/bee-manage/sys-role/recover',
    method: 'post',
    data: ids
  })
}

export function editRole(data) {
  return request({
    url: '/admin/bee-manage/sys-role/edit',
    method: 'post',
    data: paramNoNull(data)
  })
}
export function addRole(data) {
  return request({
    url: '/admin/bee-manage/sys-role',
    method: 'post',
    data: paramNoNull(data)
  })
}

export function getMenuTree() {
  return request({
    url: '/admin/bee-manage/sys-role/getMenuTree',
    method: 'get'
  })
}

export function getByRoleId(id) {
  return request({
    url: '/admin/bee-manage/sys-role-menu/' + id,
    method: 'get'
  })
}
export function editRoleMenuBatch(data) {
  return request({
    url: '/admin/bee-manage/sys-role-menu/editBatch',
    method: 'post',
    data: data
  })
}

export function getAllPermission() {
  return request({
    url: '/admin/bee-manage/sys-permission/getAllPermission',
    method: 'get'
  })
}

export function getPermissionByRoleId(id) {
  return request({
    url: '/admin/bee-manage/sys-role-permission/' + id,
    method: 'get'
  })
}

export function editRolePermissionBatch(data) {
  return request({
    url: '/admin/bee-manage/sys-role-permission/editBatch',
    method: 'post',
    data: data
  })
}
